<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0028)http://jdbi.org/archive.html -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>


<title>abacus-common</title>

<script type="text/javascript" src="./css/ga.js"></script>
<script type="text/javascript">
	if (top.location != self.location)
		top.location.replace(self.location);
</script>

<link href="./css/css" rel="stylesheet" type="text/css"></link>
<link href="./css/css(1)" rel="stylesheet" type="text/css"></link>
<link rel="stylesheet" href="./css/syntax.css" type="text/css"></link>
<link rel="stylesheet" href="./css/screen.css" type="text/css"></link>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-65247258-1', 'auto');
  ga('send', 'pageview');
</script>

</head>
<body>
	<div id="site">
		<h1>
			<a href="./index.html">abacus-common</a> <span id="navigation"> <a href="./docs.html">Docs</a> | <a href="./download.html">Download</a>
				| <a href="./api-docs/index.html">Javadoc</a> | <a href="./faq.html">FAQ</a> | <a href="./community.html">Community</a>
			</span>
		</h1>
	</div>

	<div id="content">

		<div id="page">

			<h1>Parse/Analyze/Operate (Big) Data (on N servers in parallel)</h1>

			<p>With the APIs provided in <a href="./CSVUtil_view.html">CSVUtil</a>(<i>load/import/export/parse/...</i>), <a href="./JdbcUtil_view.html">JdbcUtil</a>(<i>extractData/importData/parse/copy/...</i>), <a href="./IOUtil_view.html">IOUtil</a>(<i>parse/read/write/...</i>), <a href="./DataSet_view.html">DataSet</a>(<i>count/filter/join/group/merge/...</i>), <a href="./api-docs/com/landawn/abacus/util/N.html">N</a>(<i>...</i>), <a href="./JSONParser_view.html">JSONParser</a>/<a href="./XMLParser_view.html">XMLParser</a> and Lambad/Stream in Java 8, 
			It's super easy/fast to parse/analyze/operate GB/TB data stored in files (with format: CSV/JSON/XML/...) or database in single/multiple machines. <a href="./api-docs/com/landawn/abacus/util/RemoteExecutor.html">RemoteExecutor</a> is designed to run the Big/Heavy data processes on N servers in parallel.</p>

<!-- HTML generated using hilite.me --><div style="background: #f8f8f8; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #408080; font-style: italic">// export the account data to CSV file from database</span>
CSVUtil<span style="color: #666666">.</span><span style="color: #7D9029">exportCSV</span><span style="color: #666666">(</span>file<span style="color: #666666">,</span> conn<span style="color: #666666">,</span> sql<span style="color: #666666">,</span> <span style="color: #666666">0,</span> <span style="color: #666666">1000,</span> <span style="color: #008000; font-weight: bold">true</span><span style="color: #666666">,</span> <span style="color: #008000; font-weight: bold">true</span><span style="color: #666666">);</span>

<span style="color: #408080; font-style: italic">// load data from CSV file.</span>
DataSet dataset <span style="color: #666666">=</span> CSVUtil<span style="color: #666666">.</span><span style="color: #7D9029">loadCSV</span><span style="color: #666666">(</span>Account<span style="color: #666666">.</span><span style="color: #7D9029">class</span><span style="color: #666666">,</span> file<span style="color: #666666">);</span>

<span style="color: #408080; font-style: italic">//find out all the account with first name ended with &quot;6&quot;.</span>
DataSet account6 <span style="color: #666666">=</span> dataset<span style="color: #666666">.</span><span style="color: #7D9029">filter</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;first_name&quot;</span><span style="color: #666666">,</span> <span style="color: #666666">(</span>String fn<span style="color: #666666">)</span> <span style="color: #666666">-&gt;</span> fn<span style="color: #666666">.</span><span style="color: #7D9029">endsWith</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;6&quot;</span><span style="color: #666666">));</span>

<span style="color: #408080; font-style: italic">// group by last name and count it.</span>
DataSet groupedAccount6 <span style="color: #666666">=</span> account6<span style="color: #666666">.</span><span style="color: #7D9029">groupBy</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;last_name&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;last_name&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;count&quot;</span><span style="color: #666666">,</span> Collectors<span style="color: #666666">.</span><span style="color: #7D9029">counting</span><span style="color: #666666">());</span>

<span style="color: #408080; font-style: italic">// save the result into CSV</span>
File out <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">new</span> File<span style="color: #666666">(</span><span style="color: #BA2121">&quot;./unittest/result.csv&quot;</span><span style="color: #666666">);</span>
groupedAccount6<span style="color: #666666">.</span><span style="color: #7D9029">toCSV</span><span style="color: #666666">(</span>out<span style="color: #666666">);</span>
</pre></div>


		<br></br> 
	</div>
</body>

</html>